package com.examlpe.cels.entity;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class TestRecord implements Comparable<TestRecord>,Serializable{

	private static final long serialVersionUID = 6708664290642149261L;
	// 时间		long	--> toString的位置上去修改成String类型
		private long time;
		// 测试时长		String
		private String time_length;
		// 题目总数
		private int sum;
		// 完成的题目数
		private int finish;
		// 正确的个数
		private int right;
		// 错误的个数
		private int error;
		// 完成的内容		List<BaseTerm>
		private List<BaseTerm> paper;
	
    public long getTime() {
		return time;
	}

	public void setTime(long time) {
		this.time = time;
	}

	public String getTime_length() {
		return time_length;
	}

	public void setTime_length(String time_length) {
		this.time_length = time_length;
	}

	public int getSum() {
		return sum;
	}

	public void setSum(int sum) {
		this.sum = sum;
	}

	public int getFinish() {
		return finish;
	}

	public void setFinish(int finish) {
		this.finish = finish;
	}

	public int getRight() {
		return right;
	}

	public void setRight(int right) {
		this.right = right;
	}

	public int getError() {
		return error;
	}

	public void setError(int error) {
		this.error = error;
	}

	public List<BaseTerm> getPaper() {
		return paper;
	}

	public void setPaper(List<BaseTerm> paper) {
		this.paper = paper;
	}

	
	public TestRecord() {
		super();
	}

	
	public TestRecord(long time, String time_length, int sum, int finish, int right, int error, List<BaseTerm> paper) {
		super();
		this.time = time;
		this.time_length = time_length;
		this.sum = sum;
		this.finish = finish;
		this.right = right;
		this.error = error;
		this.paper = paper;
	}

	//	测试时间：2019-04-26 14:56:13 , 测试时长：0秒
//	测数总题数：1 , 完成题数：1
//	正确个数：0 , 错误个数：1
//	本次测试数据如下：
//	1. Haste
	//@Override
	public int compareTo(TestRecord o) {
		return (int)(o.time-this.time);
	}

	@Override
	public String toString() {
		String str ="";
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss:ms");
		String now = sdf.format(new Date());
		str += ("测试时间："+now+" , 测试时长："+this.time_length+"\n" + 
				"测数总题数："+this.sum+", 完成题数："+this.finish+"\n" + 
				"正确个数："+this.right+" , 错误个数："+this.error+"\n" + 
				"本次测试数据如下：");
		for(int i=0;i<this.paper.size();i++) {
			if(i%5==0) {
				str+="\n";
			}
			str += (i+1)+"."+this.paper.get(i).getEn()+"\t\t";
		}
		return str;
	}
}
